package com.cosmoplat.xikai.business.domain.mes.req;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;

import java.util.Date;

/**
 * @ClassName MesLineAlarmRequest
 * @Description TODO
 * @Author wdf
 * @Date 2025/1/10
 */
@Data
public class MesLineAlarmRequest {

    @ApiModelProperty(value = "报警唯一标识", required = true, example = "ALM001")
    private String id;


    @ApiModelProperty(value = "派工单ID", required = true, example = "WO001")
    private String orderID;

    @ApiModelProperty(value = "派工任务ID", required = true, example = "WOT001")
    private String taskID;

    @ApiModelProperty(value = "工序号", example = "2")
    private String processNo;

    @ApiModelProperty(value = "报警代码", required = true, example = "ERR123")
    private String alarmCode;

    @ApiModelProperty(value = "报文", example = "设备故障详情...")
    private String deviceInfo;

    /**
     *
     * 异常的类型
     * 1设备异常
     * 2物料异常
     * 3生产异常
     * 4质量异常
     **/
    @ApiModelProperty(value = "异常类型", example = "机械/电气")
    private String exceptionType;

    /**
     *
     * 具体异常的信息：如：类型设备异常，此字段传递异常设备号，多个以逗号隔开
     **/
    @ApiModelProperty(value = "异常的信息", example = "详细描述...")
    private String exceptionInfo;

    /**
     * 发送异常报告的人员编号，人工工位此信息必填
     **/
    @ApiModelProperty(value = "异常发送人", example = "李四")
    private String sender;

    /** 非必填 */
    @ApiModelProperty(value = "异常位置", example = "生产线3号")
    private String location;

    // 非必填
    @ApiModelProperty(value = "异常生产中心", example = "生产中心A")
    private String productionCenter;

    @ApiModelProperty(value = "创建时间", example = "2025-01-10 16:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime = new Date();

    @ApiModelProperty(value = "最后修改时间", example = "2025-01-10 16:01:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastModifiedTime = new Date();

    @Getter
    public static enum MesExceptionType {
        /**
         *异常的类型
         * 1 设备异常
         * 2 物料异常
         * 3 生产异常
         * 4 质量异常
         **/
        MACHINE_EQUIPMENT("1", "设备异常"),
        MATERIAL("2", "物料异常"),
        PRODUCTION("3", "生产异常"),
        QUALITY("4", "质量异常");

        private String code;
        private String desc;

        MesExceptionType(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }
    }
}
